#include <iostream>
using namespace std;

/*
   前置--和后置--重载
*/

class Cat
{
public:
    Cat(string name, int age)
    {
        this->name = name;
        this->age = age;
    }

    void show() const
    {
        cout << "name: " << name << " age: " << age << endl;
    }

    Cat operator--()
    {
        age--;
        return *this;
    }

    Cat operator--(int)
    {
        Cat temp = *this;
        age--;
        return temp;
    }

private:
    string name;
    int age;
};

int main()
{
    Cat c1("Tom", 3);
    c1.show();

    Cat c2 = c1--;
    c2.show();

    Cat c3 = --c1;
    c3.show();
}

